/*
 * 作者: junmu
 * 时间: 2025-07-22
 */
package com.hzbc.faceattendance.config;

import com.hzbc.faceattendance.model.SystemConfig;
import io.jsonwebtoken.security.Keys;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.crypto.SecretKey;

@Configuration
public class JwtConfig {

//    @Value("${jwt.secret}")
//    private String secret;
//
//    @Value("${jwt.expiration}")
//    private Long expiration;
    @Autowired
    SystemConfig systemConfig;

    @Bean
    public SecretKey secretKey() {
        return Keys.hmacShaKeyFor(systemConfig.getJwtSecret().getBytes());
    }

    public Long getExpiration() {
        return systemConfig.getJwtExpirationMs();
    }
}